#jd-product-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: white;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#jd-product-viewer .header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background-color: #e2231a;
  color: white;
  flex-shrink: 0;
}

#jd-product-viewer .header h2 {
  margin: 0;
  flex-direction: column;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

#jd-product-viewer .header-buttons {
  display: flex;
  align-items: center;
}

#jd-product-viewer .search-container {
  display: flex;
  align-items: center;
  margin: 0 20px;
}

#jd-product-viewer #search-input {
  padding: 5px 10px;
  border: none;
  border-radius: 4px 0 0 4px;
  outline: none;
  width: 200px;
}

#jd-product-viewer #search-btn {
  background-color: white;
  color: #e2231a;
  border: none;
  padding: 5px 10px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

#jd-product-viewer #search-btn:hover {
  background-color: #f0f0f0;
}

#jd-product-viewer #close-viewer-btn {
  font-size: 24px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

#jd-product-viewer #close-viewer-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

#jd-product-viewer .header-button {
  background-color: transparent;
  border: 1px solid white;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#jd-product-viewer .header-button:hover {
  background-color: white;
  color: #e2231a;
}

#jd-product-viewer #close-viewer-btn {
  font-size: 24px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

#jd-product-viewer .search-container {
  display: flex;
  align-items: center;
}

#jd-product-viewer #search-input {
  padding: 5px 10px;
  border: none;
  border-radius: 4px 0 0 4px;
  outline: none;
}

#jd-product-viewer #search-btn {
  background-color: white;
  color: #e2231a;
  border: none;
  padding: 5px 10px;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  transition: all 0.3s ease;
}

#jd-product-viewer #search-btn:hover {
  background-color: #f0f0f0;
}

#jd-product-viewer #pagination-info {
  flex-grow: 1;
  text-align: center;
}

#jd-product-viewer #pagination-info .jPage {
  display: inline-block;
  color: white;
  font-size: 14px;
}

#jd-product-viewer #pagination-info .jPage em,
#jd-product-viewer #pagination-info .jPage span,
#jd-product-viewer #pagination-info .jPage a {
  margin: 0 5px;
}

#jd-product-viewer #pagination-info .jPage a {
  color: white;
  text-decoration: none;
}

#jd-product-viewer #pagination-info .jPage a.current {
  font-weight: bold;
}

#jd-product-viewer #close-viewer-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  margin-right: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  transition: background-color 0.3s ease;
}

#jd-product-viewer #close-viewer-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

#jd-product-viewer #products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  column-gap: 20px; /* 保持左右间隔不变 */
  row-gap: 15px; /* 增加上下间隔 */
  overflow-y: auto;
  border-left: 1px solid #e0e0e0;
  border-right: 1px solid #e0e0e0;
  box-sizing: border-box;
  width: calc(100% - 40px);
  height: auto;
  max-height: calc(100vh - 250px); 
  margin-right: 37px;
  flex-grow: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 1560px;
  margin-left: auto;
  margin-right: auto;
}

#jd-product-viewer #products::-webkit-scrollbar {
  width: 0;
  height: 0;
  background: transparent;
}

/* 添加产品图片样式 */
#jd-product-viewer .product img {
  width: 100%;
  height: auto;
  max-width: 220px;
  max-height: 220px;
  object-fit: cover;
  display: block;
  margin-bottom: 10px;
}

#jd-product-viewer .product {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 5px 20px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  background-color: #ffffff;
  overflow: hidden;
}

#jd-product-viewer .product:hover {
  transform: translateY(-5px); /* 悬停时轻微上浮 */
  box-shadow: 0 5px 15px rgba(0,0,0,0.15); /* 悬停时增强阴影 */
}

#jd-product-viewer .product .close-product {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#jd-product-viewer .product:hover .close-product {
  opacity: 1;
}

#jd-product-viewer .product .close-product:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

#jd-product-viewer .product-info {
  width: 100%;
}

#jd-product-viewer .product-info h3 {
  font-size: 14px;
  margin: 0 0 10px 0;
  line-height: 1.4;
  max-height: 4.2em;
  -webkit-line-clamp: 3;
  text-align: left;
  text-indent: 0; /* 移除首行缩进 */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  color: #333; /* 更深的文字颜色 */
}

#jd-product-viewer .product-info .price {
  font-size: 18px;
  color: #e2231a;
  font-weight: bold;
}

#jd-product-viewer .product-info .reviews {
  font-size: 12px;
  color: #888;
  margin-top: 0;
}

#jd-product-viewer .product-info .price-reviews {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  width: 100%;
}

/* 添加右侧边栏 */
#jd-product-viewer::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40px; /* 将宽度从37px调整为40px */
  height: 100%;
  background-color: #f0f0f0;
  border-left: 1px solid #e0e0e0;
}

#jd-product-viewer .header #current-page {
  color: white;
  margin-right: 20px;
}

#jd-product-viewer .header #total-page {
  color: white;
  margin-right: 20px;
}

#jd-product-viewer .pagination-buttons {
  position: fixed; /* 改为固定定位 */
  bottom: 0;
  left: 0;
  right: 40px; /* 调整为40px，与新的侧边栏宽度一致 */
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px; /* 从10px减少到8px */
  background-color: #f0f0f0;
  border-top: 1px solid #e0e0e0;
}

#jd-product-viewer .pagination-buttons #page-info {
  font-size: 14px;
  color: #333;
  background-color: #fff;
  padding: 5px 10px;
  border-radius: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

#jd-product-viewer .pagination-buttons #page-info span {
  display: inline-flex;
  align-items: center;
}

#jd-product-viewer .pagination-buttons #page-info span::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background-color: #e2231a;
  border-radius: 50%;
  margin-right: 5px;
}


#jd-product-viewer .pagination-buttons button {
  padding: 5px 15px;
  background-color: #e2231a;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#jd-product-viewer .pagination-buttons button:hover {
  background-color: #c81e17;
}

#jd-product-viewer .pagination-buttons button:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

@media (max-width: 1200px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  #jd-product-viewer .product-info h3 {
    font-size: 14px;
  }

  #jd-product-viewer .product-info .price {
    font-size: 16px;
  }

  #jd-product-viewer .product-info .reviews {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    max-height: calc(100vh - 160px); /* 从180px减少到160px */
    padding-bottom: 80px; /* 从100px减少到80px */
  }

  #jd-product-viewer .product {
    padding: 10px;
  }

  #jd-product-viewer .product-info h3 {
    font-size: 12px;
    -webkit-line-clamp: 2;
    max-height: 2.6em;
  }

  #jd-product-viewer .product-info .price {
    font-size: 14px;
  }

  #jd-product-viewer .product-info .reviews {
    font-size: 10px;
  }

  #jd-product-viewer .pagination-buttons {
    flex-direction: column;
    gap: 10px;
    padding: 8px; /* 从10px减少到8px */
  }
}

@media (min-width: 1200px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 10px 10px; /* 减少大屏幕上的左右内边距 */
  }
}

@media (max-width: 1199px) and (min-width: 1000px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 999px) and (min-width: 800px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 799px) and (min-width: 600px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 599px) and (min-width: 400px) {
  #jd-product-viewer #products {
    grid-template-columns: repeat(1, 1fr);
  }
}

.reviews.highlighted {
  font-weight: bold;
  color: #1e90ff; /* 深天蓝色 */
}

/* 在文件末尾添加以下样式 */

/* 子图容器样式 */
.wraps-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
    max-width: 100%;
}

/* 子图样式 */
.wrap-image {
    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    min-height: 25px !important;
    max-width: 25px !important;
    max-height: 25px !important;
    margin: 2px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    transition: transform 0.2s ease;
}

.wrap-image:hover {
    transform: scale(1.1);
}

/* 调整产品卡片布局 */
#jd-product-viewer .product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}


#jd-product-viewer .product .main-image {
    width: 100%;
    height: auto;
    max-width: 200px; /* 稍微减小最大宽度 */
    max-height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

#jd-product-viewer .product-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* 图片缩放效果 */
#jd-product-viewer .product .main-image,
#jd-product-viewer .product .wrap-image {
    transition: transform 0.3s ease;
}

/* 为主图添加额外的样式，确保有足够的空间进行缩放 */
#jd-product-viewer .product {
    overflow: visible;
}

#jd-product-viewer .product .main-image,
#jd-product-viewer .product .wrap-image {
    transform-origin: center center;
}

/* 为子图添加额外的样式 */
.wraps-container {
    overflow: visible;
}

/* 图片缩放效果， 用作预览，js中添加preview-active类 */
#jd-product-viewer .product img.preview-active,
#jd-product-viewer .wrap-image.preview-active {
    transform: scale(4) !important;
    z-index: 1000;
    position: relative;
}

/* 确保主图片和子图片在非预览状态下的样式不会干扰预览效果 */
#jd-product-viewer .product .main-image,
#jd-product-viewer .product .wrap-image {
    transition: transform 0.3s ease;
    transform: scale(1);
}

/* 悬停效果不应该影响预览状态 */
#jd-product-viewer .product:hover .main-image:not(.preview-active) {
    transform: scale(1.05);
}

/* 添加一个新的样式来处理最后一行的边距 */
#jd-product-viewer #products::after {
  content: '';
  flex: auto;
}

#jd-product-viewer #jDimension {
  width: calc(100% - 40px); /* 与 #products 宽度一致 */
  max-width: 1560px; /* 与 #products 最大宽度一致 */
  margin-left: auto;
  margin-right: auto;
  padding: 20px;
  background-color: #f8f8f8;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 20px; /* 保留底部间距 */
}

#jd-product-viewer .jModulesTitle {
  font-size: 18px;
  font-weight: bold;
  color: #333;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
  position: relative; /* 添加相对定位 */
}

#jd-product-viewer .toggle-dimension {
  position: absolute; /* 使用绝对定位 */
  top: 0;
  right: 0;
  cursor: pointer;
  color: #e2231a;
  font-size: 14px;
  font-weight: normal;
}

#jd-product-viewer .toggle-dimension:hover {
  text-decoration: underline;
}

#jd-product-viewer .jDimensionSelec {
  margin-top: 20px;
  overflow: hidden;
  transition: max-height 0.3s ease-out, overflow-y 0.3s ease-out;
  max-height: 0; /* 默认高度为折叠状态 */
  position: relative; /* 添加相对定位 */
}

#jd-product-viewer .jDimensionSelec.expanded {
  max-height: 700px; /* 展开时的最大高度 */
  overflow-y: auto; /* 添加垂直滚动条 */
}

#jd-product-viewer .expand-all-container {
  width: 100%;
  text-align: center;
  padding: 10px 0;
  background-color: #f8f8f8;
  border-top: 1px solid #e0e0e0;
}

#jd-product-viewer .expand-all-btn {
  padding: 5px 15px;
  background-color: #fff;
  border: 1px solid #e2231a;
  border-radius: 4px;
  color: #e2231a;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

#jd-product-viewer .expand-all-btn:hover {
  background-color: #e2231a;
  color: #fff;
}

#jd-product-viewer .jKeyword {
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  list-style-type: none;
}

#jd-product-viewer .jKeyword a {
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 14px;
}

#jd-product-viewer .jKeyword a:not(.jWords):not(.jCancel) {
  color: #333;
  background-color: #f0f0f0;
}

#jd-product-viewer .jKeyword a:not(.jWords):not(.jCancel):hover {
  background-color: #e0e0e0;
}

#jd-product-viewer .jKeyword .jCancel {
  color: #999;
}

#jd-product-viewer .jKeyword .jCancel:hover {
  color: #e2231a;
}

#jd-product-viewer .jKeyword .jWords {
  background-color: #fff;
  border: 1px solid #e2231a;
  color: #e2231a;
  display: inline-flex;
  align-items: center;
}

#jd-product-viewer .jKeyword .jWords:hover {
  background-color: #fff5f5;
}

#jd-product-viewer .jKeyword .jWords b {
  margin-right: 5px;
  font-weight: normal;
  font-size: 0.5rem;
  color: #999;
}

#jd-product-viewer .jKeyword .jWords strong {
  font-weight: bold;
}

@media (max-width: 768px) {
  #jd-product-viewer .jKeyword {
    flex-direction: column;
    align-items: flex-start;
  }
}

#jd-product-viewer .jDimensionSelec dl {
  border-bottom: 1px solid #e0e0e0;
  padding: 10px 0;
  display: flex;
  align-items: flex-start;
}

#jd-product-viewer .jDimensionSelec dt {
  width: 100px;
  font-weight: bold;
  color: #333;
  flex-shrink: 0;
}

#jd-product-viewer .jDimensionSelec dd {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#jd-product-viewer .jDimensionSelec a {
  padding: 5px 10px;
  background-color: #f5f5f5;
  border-radius: 4px;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
}

#jd-product-viewer .jDimensionSelec a:hover {
  background-color: #e2231a;
  color: #fff;
}

#jd-product-viewer .priceSearch {
  display: flex;
  align-items: center;
  gap: 10px;
}

#jd-product-viewer .priceSearch input[type="text"] {
  width: 60px;
  padding: 5px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
}

#jd-product-viewer #price-search-btn {
  padding: 5px 10px;
  background-color: #e2231a;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#jd-product-viewer #price-search-btn:hover {
  background-color: #c81e17;
}

#jd-product-viewer .selectMore {
  color: #e2231a;
  cursor: pointer;
  margin-left: 10px;
}

#jd-product-viewer .selectMore b {
  display: inline-block;
  transition: transform 0.3s ease;
}

#jd-product-viewer .selectMore:hover b {
  transform: rotate(180deg);
}

#jd-product-viewer #JMoreOptionsDiv_0 {
  margin-top: 10px;
}

@media (max-width: 768px) {
  #jd-product-viewer .jDimensionSelec dl {
    flex-direction: column;
  }
  
  #jd-product-viewer .jDimensionSelec dt {
    margin-bottom: 5px;
  }
}